'use strict';
exports.main = async (event, context) => {
	//event为客户端上传的参数
	const {code} = event;
  const res = await uniCloud.httpclient.request(
    "https://api.weixin.qq.com/sns/jscode2session?appid=wxd5144f7cee6bb4f5&secret=faa9c1791b935623e5aa65ad08181d11&js_code="+ code +"&grant_type=authorization_code",
    {
      dataType:"json"
    }
  )
  const openid = res.data.openid;
	//返回数据给客户端
	return openid
};
